package com.xlong.k329;

import android.content.Context;
import android.widget.Toast;

public class Utils {

    private static Toast toast;

    public static void toast(Context context, String message) {
        if (toast == null) {
            toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        } else {
            toast.setText(message);
        }
        toast.show();
    }

    public static void toastLong(Context context, String message) {
        if (toast == null) {
            toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        } else {
            toast.setText(message);
        }
        toast.show();
    }

    public static void misstoast(Context context){
        if (toast != null){
            toast.cancel();
            toast = null;
        }
    }
}
